package 测试01;

import java.util.Scanner;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

/**
 * Created by hest0 on 2017/7/1.
 */
public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        while (sc.hasNext()) {
            String s = sc.nextLine();
            System.out.println(solve(s));
        }
        sc.close();
    }

    public static String solve(String s) {
        String[] a = s.replaceAll("[^a-zA-Z0-9]+", " ").trim().split("\\s+");
        //String[] a = s.replaceAll("[^\\W]+", " ").trim().split("\\s+");
        StringBuilder sb = new StringBuilder();
        for (int i = a.length - 1; i > 0; i--) {
            sb.append(a[i]).append(" ");
        }
        sb.append(a[0]);
        return sb.toString();
    }
}
